﻿//1
var alertParameterType = function (param) {
    alert(typeof param);
}

//alertParameterType(true);

//2
var reverseString = function (text) {
    return text.split('').reverse().join('');
}

//alert(reverseString('what'));

//3
var reverseString2 = function (text) {
    if (!text || !(typeof(text) === 'string'))
        return 'An error has happened.';

    return text.split('').reverse().join('');
}

//4
var addTwoNums = function (num1, num2) {
    return num1 + num2;
}

//5
var multiplyTwoNums = function (num1, num2) {
    return num1 * num2;
}

//6
var capitalize = function (text) {
    return text.toUpperCase();
}

//7
var capitalizeAndReverse = function (text) {
    return reverseString2(capitalize(text));
}